Deal with _POSIX_SAVED_IDS when relinquishing privileges

$OpenBSD: patch-unix_spawn_c,v 1.3 2012/04/13 13:58:31 naddy Exp $
--- unix/spawn.c.orig	Thu May 29 08:08:49 2003
+++ unix/spawn.c	Fri Apr 13 15:57:26 2012
@@ -352,8 +352,10 @@ ixsspawn (pazargs, aidescs, fkeepuid, fkeepenv, zchdir
   if (! fkeepuid)
     {
       /* Return to the uid of the invoking user.  */
-      (void) setuid (getuid ());
+      (void) setegid (getgid ());
       (void) setgid (getgid ());
+      (void) seteuid (getuid ());
+      (void) setuid (getuid ());
     }
   else
     {
